<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

			<title>搜索页面</title>

			<link href="../../js/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet"
				type="text/css" />
			<link href="../../js/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet"
				type="text/css" />

			<link href="../../js/basic/css/demo.css" rel="stylesheet" type="text/css" />

			<link href="../../css/seastyle.css" rel="stylesheet" type="text/css" />

			<script type="text/javascript" src="../../js/basic/js/jquery-1.7.min.js"></script>
			<script type="text/javascript" src="../../js/script.js"></script>
			<script src="../../js/vue/vue.min.js"></script>
			<script src="../../js/layer/layer.js" charset="utf-8"></script>
			<script src="../../js/laypage/laypage.js" charset="utf-8"></script>
	</head>

	<body>

		<!--顶部导航条 -->
		<div class="am-container header">
			<ul class="message-l">
				<div class="topMessage">
					<div class="menu-hd">
						<#if data?exists>
							欢迎你，${data.name}
						<#else>
							<a href="#" target="_top" class="h">亲，请登录</a>
							<a href="#" target="_top">免费注册</a>
						</#if>
					</div>
				</div>
			</ul>
			<ul class="message-r">
				<div class="topMessage home">
					<div class="menu-hd">
						<a href="#" target="_top" class="h">商城首页</a>
					</div>
				</div>
				<div class="topMessage my-shangcheng">
					<div class="menu-hd MyShangcheng">
						<a href="#" target="_top"><i class="am-icon-user am-icon-fw"></i>个人中心</a>
					</div>
				</div>
				<div class="topMessage mini-cart">
					<div class="menu-hd">
						<a id="mc-menu-hd" href="#" target="_top"><i
							class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong
							id="J_MiniCartNum" class="h">0</strong> </a>
					</div>
				</div>
				<div class="topMessage favorite">
					<div class="menu-hd">
						<a href="#" target="_top"><i class="am-icon-heart am-icon-fw"></i><span>收藏夹</span>
						</a>
					</div>
			</ul>
		</div>

		<!--悬浮搜索框-->

		<div class="nav white">
			<div class="logo">
				<img src="../../images/logo.png" />
			</div>
			<div class="logoBig">
				<li>
					<img src="../../images/logobig.png" />
				</li>
			</div>

			<div class="search-bar pr">
				<a name="index_none_header_sysc" href="#"></a>
				<form method="post" action="/goods/search">
					<input id="searchInput" name="index_none_header_sysc" type="text"
						placeholder="搜索" autocomplete="off" value="${searchInput}">
						<input id="ai-topsearch" class="submit am-btn" value="搜索"
							index="1" type="submit">
				</form>
			</div>
		</div>

		<div class="clear"></div>
		<b class="line"></b>
		<div class="search"  id="center">
			<div class="search-list">
				<div class="nav-table">
					<div class="long-title">
						<span class="all-goods">全部分类</span>
					</div>
					<div class="nav-cont">
						<div class="nav-extra">
							<i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的福利
							<i class="am-icon-angle-right" style="padding-left: 10px;"></i>
						</div>
					</div>
				</div>


				<div class="am-g am-g-fixed">
					<div class="am-u-sm-12 am-u-md-12">
						<div class="theme-popover">
							<div class="searchAbout">
							</div>
							<ul class="select">
								<p class="title font-normal">
									<span class="fl"></span>
									<span class="total fl">搜索到<strong id="searchCount" class="num"></strong>件相关商品</span>
								</p>
								<div class="clear"></div>
								<li class="select-result">
									<dl>
										<dt>
											已选
										</dt>
										<dd class="select-no"></dd>
										<p class="eliminateCriteria">
											清除
										</p>
									</dl>
								</li>
								<div class="clear"></div>
								<li class="select-list">
									<dl id="select1">
										<dt class="am-badge am-round">
											品牌
										</dt>

										<div class="dd-conent">
											<dd class="select-all selected">
												<a href="javascript:void(0)" onclick="choosebrand(this),selectclick()">全部</a>
											</dd>
											<dd v-for="brand in brands">
												<a href="javascript:void(0)" v-bind:name="brand.id" onclick="choosebrand(this),selectclick()">{{brand.name}}</a>
											</dd>
											<dd>
												<a href="#">良品铺子</a>
											</dd>
											<dd>
												<a href="#">新农哥</a>
											</dd>
											<dd>
												<a href="#">楼兰蜜语</a>
											</dd>
											<dd>
												<a href="#">口水娃</a>
											</dd>
											<dd>
												<a href="#">考拉兄弟</a>
											</dd>
										</div>

									</dl>
								</li>
								<li class="select-list">
									<dl id="select2">
										<dt class="am-badge am-round">
											种类
										</dt>
										<div class="dd-conent">
											<dd class="select-all selected">
												<a href="javascript:void(0)" onclick="choosecate(this),selectclick()">全部</a>
											</dd>
											<dd v-for="cate in cates">
												<a href="javascript:void(0)" v-bind:name="cate.id" onclick="choosecate(this),selectclick()">{{cate.name}}</a>
											</dd>
											<dd>
												<a href="#">巴西松子</a>
											</dd>
											<dd>
												<a href="#">夏威夷果</a>
											</dd>
											<dd>
												<a href="#">松子</a>
											</dd>
										</div>
									</dl>
								</li>
							</ul>
							<div class="clear"></div>
						</div>
						<div class="search-content">
							<div class="sort">
								<li class="first">
									<a title="综合" href="javascript:void(0)" onclick="orderby('all')">综合排序</a>
								</li>
								<li>
									<a title="销量" href="javascript:void(0)" onclick="orderby('saleCount')">销量排序</a>
								</li>
								<li>
									<a title="价格" href="javascript:void(0)" onclick="orderby('price')">价格优先</a>
								</li>
								<li class="big">
									<a title="评价" href="javascript:void(0)" onclick="orderby('comment')">评价为主</a>
								</li>
							</div>
							<div class="clear"></div>

							<ul class="am-avg-sm-2 am-avg-md-3 am-avg-lg-4 boxes">
								<li v-for="good in goods">
									<div class="i-pic limit" v-bind:name="good.id" onclick="goodclick(this)">
										<img v-bind:src="'../../images/'+good.imgPath" style="width:218px;height:218px;" title="商品图片"/>
										<p class="title fl">
											{{good.name}}
										</p>
										<p class="price fl">
											<b>¥</b>
											<strong>{{good.price}}</strong>
										</p>
										<p class="number fl">
											库存
											<span>{{good.repertory}}</span>
										</p>
									</div>
								</li>
							</ul>
						</div>
						<div class="search-side">

							<div class="side-title">
								热销产品
							</div>
							<li v-for="hotgood in hotgoods">
								<div class="i-pic check" v-bind:name="hotgood.id" onclick="goodclick(this)">
									<img v-bind:src="'../../images/'+hotgood.imgPath" style="width:218px;height:218px;" title="商品图片"/>
									<p class="check-title">
										{{hotgood.name}}
									</p>
									<p class="price fl">
										<b>¥</b>
										<strong>{{hotgood.price}}</strong>
									</p>
									<p class="number fl">
										库存
										<span>{{hotgood.repertory}}</span>
									</p>
								</div>
							</li>
						</div>
						<div class="clear"></div>
						<!--分页 -->
						<ul id="pagenav" class="am-pagination am-pagination-right">
						</ul>

					</div>
				</div>
				<div class="posi"  id="pagenav"></div>
				<div class="footer">
					<div class="footer-hd">
						<p>
							<a href="#">恒望科技</a>
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							<a href="#">关于恒望</a>
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 Hengwang.com 版权所有</em>
						</p>
					</div>
				</div>
			</div>

		</div>

		<!--引导 -->
		<div class="navCir">
			<li>
				<a href="home.html"><i class="am-icon-home "></i>首页</a>
			</li>
			<li>
				<a href="sort.html"><i class="am-icon-list"></i>分类</a>
			</li>
			<li>
				<a href="shopcart.html"><i class="am-icon-shopping-basket"></i>购物车</a>
			</li>
			<li>
				<a href="../person/index.html"><i class="am-icon-user"></i>我的</a>
			</li>
		</div>

		<!--菜单 -->
		<div class=tip>
			<div id="sidebar">
				<div id="wrap">
					<div id="prof" class="item">
						<a href="#"> <span class="setting"></span> </a>
						<div class="ibar_login_box status_login">
							<div class="avatar_box">
								<p class="avatar_imgbox">
									<img src="../../images/no-img_mid_.jpg" />
								</p>
								<ul class="user_info">
									<li>
										用户名：sl1903
									</li>
									<li>
										级&nbsp;别：普通会员
									</li>
								</ul>
							</div>
							<div class="login_btnbox">
								<a href="#" class="login_order">我的订单</a>
								<a href="#" class="login_favorite">我的收藏</a>
							</div>
							<i class="icon_arrow_white"></i>
						</div>

					</div>
					<div id="shopCart" class="item">
						<a href="#"> <span class="message"></span> </a>
						<p>
							购物车
						</p>
						<p class="cart_num">
							0
						</p>
					</div>
					<div id="asset" class="item">
						<a href="#"> <span class="view"></span> </a>
						<div class="mp_tooltip">
							我的资产
							<i class="icon_arrow_right_black"></i>
						</div>
					</div>

					<div id="foot" class="item">
						<a href="#"> <span class="zuji"></span> </a>
						<div class="mp_tooltip">
							我的足迹
							<i class="icon_arrow_right_black"></i>
						</div>
					</div>

					<div id="brand" class="item">
						<a href="#"> <span class="wdsc"><img
									src="../../images/wdsc.png" /> </span> </a>
						<div class="mp_tooltip">
							我的收藏
							<i class="icon_arrow_right_black"></i>
						</div>
					</div>

					<div id="broadcast" class="item">
						<a href="#"> <span class="chongzhi"><img
									src="../../images/chongzhi.png" /> </span> </a>
						<div class="mp_tooltip">
							我要充值
							<i class="icon_arrow_right_black"></i>
						</div>
					</div>

					<div class="quick_toggle">
						<li class="qtitem">
							<a href="#"><span class="kfzx"></span> </a>
							<div class="mp_tooltip">
								客服中心
								<i class="icon_arrow_right_black"></i>
							</div>
						</li>
						<!--二维码 -->
						<li class="qtitem">
							<a href="#none"><span class="mpbtn_qrcode"></span> </a>
							<div class="mp_qrcode" style="display: none;">
								<img src="../../images/weixin_code_145.png" />
								<i class="icon_arrow_white"></i>
							</div>
						</li>
						<li class="qtitem">
							<a href="#top" class="return_top"><span class="top"></span> </a>
						</li>
					</div>

					<!--回到顶部 -->
					<div id="quick_links_pop" class="quick_links_pop hide"></div>

				</div>

			</div>
			<div id="prof-content" class="nav-content">
				<div class="nav-con-close">
					<i class="am-icon-angle-right am-icon-fw"></i>
				</div>
				<div>
					我
				</div>
			</div>
			<div id="shopCart-content" class="nav-content">
				<div class="nav-con-close">
					<i class="am-icon-angle-right am-icon-fw"></i>
				</div>
				<div>
					购物车
				</div>
			</div>
			<div id="asset-content" class="nav-content">
				<div class="nav-con-close">
					<i class="am-icon-angle-right am-icon-fw"></i>
				</div>
				<div>
					资产
				</div>

				<div class="ia-head-list">
					<a href="#" target="_blank" class="pl">
						<div class="num">
							0
						</div>
						<div class="text">
							优惠券
						</div> </a>
					<a href="#" target="_blank" class="pl">
						<div class="num">
							0
						</div>
						<div class="text">
							红包
						</div> </a>
					<a href="#" target="_blank" class="pl money">
						<div class="num">
							￥0
						</div>
						<div class="text">
							余额
						</div> </a>
				</div>

			</div>
			<div id="foot-content" class="nav-content">
				<div class="nav-con-close">
					<i class="am-icon-angle-right am-icon-fw"></i>
				</div>
				<div>
					足迹
				</div>
			</div>
			<div id="brand-content" class="nav-content">
				<div class="nav-con-close">
					<i class="am-icon-angle-right am-icon-fw"></i>
				</div>
				<div>
					收藏
				</div>
			</div>
			<div id="broadcast-content" class="nav-content">
				<div class="nav-con-close">
					<i class="am-icon-angle-right am-icon-fw"></i>
				</div>
				<div>
					充值
				</div>
			</div>
		</div>
<script>
window.jQuery
		|| document
				.write('<script src="../../js/basic/js/jquery-1.9.min.js"><\/script>');
</script>
<script type="text/javascript" src="../../js/basic/js/quick_links.js">
</script>
<script>
	var app = new Vue({
		el : '#center',
		data : {
			brands : [],
			goods : [],
			cates: [],
			hotgoods:[]
		}
	});
	//获取品牌js
	var getBrands = function() {
		$.ajax({
			type : "GET",
			dataType : "json",
			url : "/goods/getbrands",
			success : function(msg) {
				app.brands = msg;
			},
		});
	}
	var getCates = function(brandid) {
		$.ajax({
			type : "GET",
			dataType : "json",
			data:{
				"brandid":brandid,
			},
			url : "/goods/getcates",
			success : function(msg) {
				app.cates = msg;
			},
		});
	}
	//获取商品js
	var getGoods = function(curr,brandid,cateid,order) {
		var searchInput=$("input[name='index_none_header_sysc']").val();
		console.log(searchInput);
		$.ajax({
			type : "GET",
			dataType : "json",
			url : "/goods/getgoods",
			data : {
				"brandid":brandid,
				"cateid":cateid,
				"order":order,
				"searchInput":searchInput,
				"size":12,
				"index":curr || 1,
			//向服务端传的参数，此处只是演示
			},
			success : function(msg) {
				app.goods = msg.pageList;
				$("#searchCount").html(msg.dataTotal);
				var brandname=$("#selectA a").html();
				var bid=$("#selectA a").attr("name");
				var catename=$("#selectB a").html();
				var cid=$("#selectB a").attr("name");
				if(brandname!=null){
					if(catename!=null){
						$("ul.select span[class='fl']").html(searchInput+" "+brandname+" "+catename);
						$("div[class='searchAbout']").html("<span class='font-pale'>相关搜索：</span><a href='#'>"+searchInput+"</a> <a href='#'>"+brandname+"</a> <a title='"+catename+"' href='id="+cid+"'>"+catename+"</a>");
					}else{
						$("ul.select span[class='fl']").html(searchInput+" "+brandname);
						$("div[class='searchAbout']").html("<span class='font-pale'>相关搜索：</span><a href='#'>"+searchInput+"</a> <a href='#'>"+brandname+"</a>");
					}
				}else{
					if(catename!=null){
						$("ul.select span[class='fl']").html(searchInput+" "+catename);
						$("div[class='searchAbout']").html("<span class='font-pale'>相关搜索：</span><a href='#'>"+searchInput+"</a> <a href='#'>"+catename+"</a>");
					}else{
						$("ul.select span[class='fl']").html(searchInput);
						$("div[class='searchAbout']").html("<a href='#'>"+searchInput+"</a> ");
					}
				}
				laypage({
					cont : 'pagenav', //容器。值支持id名、原生dom对象，jquery对象,
					pages : msg.pageCount, //总页数
					first : true,
					skin: 'molv',
					last : true,
					curr : curr || 1, //当前页
					jump : function(obj, first) { //触发分页后的回调
						if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
							getGoods(obj.curr);
						}
					}
				});
			},
		});
	}
	//获取热门商品位置的商品
	function getHotGoods(){
		$.ajax({
			type : "GET",
			dataType : "json",
			url : "/goods/getgoods",
			data : {
				"order":"saleCount",
				"size":3,
				"index":1,
			//向服务端传的参数，此处只是演示
			},
			success : function(msg) {
				app.hotgoods = msg.pageList;
			},
		});
	}
	//选中品牌中一项，改变该项样式，并去除其他的样式
	function choosebrand(brand) {
		var brandid=$(brand).attr("name");
		if($(brand).closest("dd").attr("id")!="selectA"){
			//为该元素所在的dd标签添加选中样式，清除其他选中项的样式
			$(brand).closest("dd").addClass("selected").siblings().removeClass("selected");
			if ($(brand).closest("dd").hasClass("select-all")) {
				//如果选中的是全部按钮，则移除已选栏中的该组标签
				$("#selectA").remove();
			} else {
				//克隆该选中标签
				var copyThisA = $(brand).closest("dd").clone();
				if ($("#selectA").length > 0) {
					//如果已选处有该组的标签，则修改所需要修改的值
					$("#selectA a").html($(brand).closest("dd").text());
					$("#selectA a").attr("name",brandid);
				} else {
					//如果没有，在该行后面追加该节点
					$(".select-result dl").append(copyThisA.attr("id", "selectA"));
				}
			}
		}else{//选择全部按钮的操作
			$(brand).closest("dd").remove();
			$("#select1 .select-all").addClass("selected").siblings().removeClass("selected");
		}
		brandid=$("#selectA a").attr("name");//获取该name属性值
		var cateid=$("#selectB a").attr("name");
		getCates(brandid);
		getGoods(1,brandid,cateid);//进行查询该条件下商品
	}
	//选中种类中一项，改变该项样式，并去除其他的样式，所有方法如上
	function choosecate(cate) {
		var cateid=$(cate).attr("name");
		if($(cate).closest("dd").attr("id")!="selectB"){
			//为该元素所在的dd标签添加选中样式，清除其他选中项的样式
			$(cate).closest("dd").addClass("selected").siblings().removeClass("selected");
			if ($(cate).closest("dd").hasClass("select-all")) {
				//如果选中的是全部按钮，则移除已选栏中的该组标签
				$("#selectB").remove();
			} else {
				//克隆该选中标签
				var copyThisB = $(cate).closest("dd").clone();
				if ($("#selectB").length > 0) {
					//如果已选处有该组的标签，则修改所需要修改的值
					$("#selectB a").html($(cate).closest("dd").text());
					$("#selectB a").attr("name",cateid);
				} else {
					//如果没有，在该行后面追加该节点
					$(".select-result dl").append(copyThisB.attr("id", "selectB"));
				}
			}
		}else{//选择全部按钮的操作
			$(cate).closest("dd").remove();
			$("#select2 .select-all").addClass("selected").siblings().removeClass("selected");
		}
		cateid=$("#selectB a").attr("name");
		var brandid=$("#selectA a").attr("name");
		getGoods(1,brandid,cateid);
	}
	//点击触发排序函数
	function orderby(order){
		var brandid=$("#selectA a").attr("name");
		var cateid=$("#selectB a").attr("name");
		getGoods(1,brandid,cateid,order);
	}
	//点击跳转到商品详情页
	function goodclick(thisclick){
		var id=$(thisclick).attr("name");
		location.href="/goods/getgoodsbean?id="+id;
	}
	//单击dd按钮时进行的判断，如果已选栏为空，进行隐藏
	function selectclick(){
		if ($(".select-result dd").length > 1) {
			$(".select-no").hide();
			$(".eliminateCriteria").show();
			$(".select-result").show();
		} else {
			$(".select-no").show();
			$(".select-result").hide();
		}
	}
	getBrands();
	getGoods();
	getCates();
	getHotGoods();
</script>

		<div class="theme-popover-mask"></div>

	</body>

</html>